package com.znjc.device.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.znjc.device.domain.IotDataCheck;
import com.znjc.device.mapper.IotDataCheckMapper;
import com.znjc.device.service.IIotDataCheckService;
import com.znjc.device.service.IIotSerialCheckRefService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author zengpc
 * @date 2023-12-04
 */
@Service
public class IotDataCheckServiceImpl extends ServiceImpl<IotDataCheckMapper, IotDataCheck> implements IIotDataCheckService {

    @Resource
    IIotSerialCheckRefService iotSerialCheckRefService;
    @Override
    public List<IotDataCheck> getIotDataCheckListBySerialId(Long serialId) {
        List<Long> checkIds = iotSerialCheckRefService.getIdList(serialId,1);
        if(CollectionUtils.isEmpty(checkIds)){
            return new ArrayList<>();
        }
        LambdaQueryWrapper<IotDataCheck> wrapper = new LambdaQueryWrapper<>();
        wrapper.in(IotDataCheck::getId,checkIds);
        return this.list(wrapper);
    }
}
